<!--
Copyright 2018 Google LLC. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================
-->

<!doctype html>

<head>
  <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.cyan-teal.min.css" />
</head>

<style>
  .input-div {
    padding: 5px;
    font-family: monospace;
  }

  .predict-div {
    padding: 5px;
    padding-top: 20px;
  }

  .predict-table {
    font-family: monospace;
    table-layout: fixed;
    border-collapse: collapse;
    border: 1px solid black;
  }

  td {
    padding-left: 5px;
    padding-right: 5px;
    padding-bottom: 5px;
  }

  #predict-header {
    font-weight: bold;
  }

  .output-div {
    padding: 5px;
    padding-top: 20px;
    font-family: monospace;
    font-weight: bold;
  }

  .retrain-div {
    padding: 5px;
    padding-top: 20px;
    padding-bottom: 30px;
    font-family: monospace;
    font-weight: bold;
  }

  #image-input {
    font-family: monospace;
    position: relative;
    width: 100%;
  }

  body {
    margin-top: 25px;
    margin-left: 25px;
  }
</style>

<body>
  <h1>TensorFlow.js Layers: MNIST CNN Transfer Learning Demo</h1>

  <div class="create-model">
    <button id="load-pretrained-remote" style="display:none">Load hosted pretrained model</button>
    <button id="load-pretrained-local" style="display:none">Load local pretrained model</button>
  </div>

  <div class="retrain-div">
    <div>
      <span>Training mode:</span>
      <select id="training-mode" class="form-control">
        <option value="freeze-feature-layers">Freeze feature layers</option>
        <option value="no-freezing">Don't freeze feature layers</option>
        <option value="reinitialize-weights">Reinitialize weights</option>
      </select>

      <input class="input" id="epochs" value="10" style="width:3em">
      <span>epochs</span>

      <button class="btn btn-primary" id="retrain" disabled="true"><span>Retrain</span></button>
    </div>
    <div>

    </div>
    <progress id="trainProg" value="0" max="100" style="width:35%"></progress>
    <span id="status"></span>
  </div>

  <select id="test-image-select" class="form-control" disabled="true">
    <option class="head">Select test example</option>
    <option value="5_1">5_1</option>
    <option value="5_2">5_2</option>
    <option value="5_3">5_3</option>
    <option value="5_4">5_4</option>
    <option value="5_5">5_5</option>
    <option value="5_6">5_6</option>
    <option value="5_7">5_7</option>
    <option value="5_8">5_8</option>
    <option value="5_9">5_9</option>
    <option value="5_10">5_10</option>
    <option value="6_1">6_1</option>
    <option value="6_2">6_2</option>
    <option value="6_3">6_3</option>
    <option value="6_4">6_4</option>
    <option value="6_5">6_5</option>
    <option value="6_6">6_6</option>
    <option value="6_7">6_7</option>
    <option value="6_8">6_8</option>
    <option value="6_9">6_9</option>
    <option value="6_10">6_10</option>
    <option value="7_1">7_1</option>
    <option value="7_2">7_2</option>
    <option value="7_3">7_3</option>
    <option value="7_4">7_4</option>
    <option value="7_5">7_5</option>
    <option value="7_6">7_6</option>
    <option value="7_7">7_7</option>
    <option value="7_8">7_8</option>
    <option value="7_9">7_9</option>
    <option value="7_10">7_10</option>
    <option value="8_1">8_1</option>
    <option value="8_2">8_2</option>
    <option value="8_3">8_3</option>
    <option value="8_4">8_4</option>
    <option value="8_5">8_5</option>
    <option value="8_6">8_6</option>
    <option value="8_7">8_7</option>
    <option value="8_8">8_8</option>
    <option value="8_9">8_9</option>
    <option value="8_10">8_10</option>
    <option value="9_1">9_1</option>
    <option value="9_2">9_2</option>
    <option value="9_3">9_3</option>
    <option value="9_4">9_4</option>
    <option value="9_5">9_5</option>
    <option value="9_6">9_6</option>
    <option value="9_7">9_7</option>
    <option value="9_8">9_8</option>
    <option value="9_9">9_9</option>
    <option value="9_10">9_10</option>
  </select>

  <textarea id="image-input" rows="28"></textarea>

  <div class="predict-div">
    <table class="predict-table">
      <tr id="predict-header">
      </tr>
      <tr id="predict-values">
      </tr>
    </table>
  </div>

  <div class="output-div">
    <span class="output-label">Output class: </span>
    <span id="winner"></input>
  </div>

  <script src="index.js"></script>
</body>
